import {
	createStore,
	combineReducers,
	applyMiddleware,
	compose
} from 'redux';

import reducers from './reducers';
import thunk from 'redux-thunk';

import {
	h0
} from '../../common/fp';

import {
	ORDER_DEPART
} from '../constant';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

export default createStore(
	combineReducers(reducers), {
		from: null,
		to: null,
		departDate: h0(Date.now()),
		highSpeed: false,
		trainList: [],
		orderType: ORDER_DEPART,
		onlyTickets: false,
		isFiltersVisible: false,

		ticketTypes: [],
		checkedTicketTypes: {},
		trainTypes: [],
		checkedTrainTypes: {},
		departStations: [],
		checkedDepartStations: {},
		arriveStations: [],
		checkedArriveStations: {},
	},
	composeEnhancers(applyMiddleware(thunk))
);